package com.thinkit.bigdata.web.service.impl.config;

import com.thinkit.bigdata.core.feature.orm.mybatis.Page;
import com.thinkit.bigdata.core.log.Tag;
import com.thinkit.bigdata.core.log.TagDel;
import com.thinkit.bigdata.core.log.TagUpdate;
import com.thinkit.bigdata.web.dao.config.SysAreaMapper;
import com.thinkit.bigdata.web.model.config.SysArea;
import com.thinkit.bigdata.web.model.config.SysAreaDto;
import com.thinkit.bigdata.web.model.config.SysAreaExample;
import com.thinkit.bigdata.web.service.config.AreaService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by BanAiQin on 2016/12/13.
 */

@Service
public class AreaServiceImpl implements AreaService {

    @Resource
    private SysAreaMapper mapper;

    @Override
    public int countByExample(SysAreaExample example) {
        return mapper.countByExample(example);
    }

    @Override
    public int deleteByExample(SysAreaExample example) {
        return mapper.deleteByExample(example);
    }

    @TagDel
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SysArea record) {
        return mapper.insert(record);
    }

    @Tag
    @Override
    public int insertSelective(SysArea record) {
        return mapper.insertSelective(record);
    }

    @Override
    public List<SysArea> selectByExample(SysAreaExample example) {
        return mapper.selectByExample(example);
    }

    @Override
    public List<SysArea> selectByExample(Page<SysArea> page, SysAreaExample example) {
        return mapper.selectByExample(page, example);
    }

    @Override
    public SysArea selectByPrimaryKey(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public SysArea selectByPrimaryCode(String code) {
        SysAreaExample areaExample = new SysAreaExample();
        areaExample.createCriteria().andCodeEqualTo(code);
        return mapper.selectByExample(areaExample).get(0);
    }

    @Override
    public int updateByExampleSelective(SysArea record, SysAreaExample example) {
        return mapper.updateByExampleSelective(record, example);
    }

    @Override
    public int updateByExample(SysArea record, SysAreaExample example) {
        return mapper.updateByExample(record, example);
    }

    @TagUpdate
    @Override
    public int updateByPrimaryKeySelective(SysArea record) {
        return mapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(SysArea record) {
        return mapper.updateByPrimaryKey(record);
    }

    @Override
    public SysArea selectAreaByUserId(Long userId) {
        return mapper.selectAreaByUserId(userId);
    }

    @Override
    public List<SysAreaDto> selectAllArea() {
        return mapper.selectAllArea();
    }
}
